/*
 * j4Win
 *  http://code.google.com/p/j4win/
 *
 * Copyright (C) 2006-2007 Felix Geyer, Moritz Laschinger
 *
 * This file is part of j4Win.
 *
 * j4Win is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2 as published by the Free Software Foundation.
 *
 * j4Win is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

package j4win;

import java.net.InetSocketAddress;
import java.net.Socket;

public class NetworkClient extends Network {
	private String host;
	private int port;
	
	public NetworkClient(NetworkListener listener, String host, int port) {
		super(listener);
		
		this.host = host;
		this.port = port;
	}
	
	@Override
	public void run() {
		try {
			socket = new Socket();
			socket.setSoTimeout(1000);
			socket.connect(new InetSocketAddress(host, port), 1000);
			out = socket.getOutputStream();
			in =  socket.getInputStream();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		super.run();
	}
}
